---
category: Function
created: '2020-05-15'
title: Check if a value is a generator function
---

**JavaScript version**

```js isGeneratorFunction.js
const isGeneratorFunction = (v) => Object.prototype.toString.call(v) === '[object GeneratorFunction]';
```

**Examples**

```js examples.js
isGeneratorFunction(function () {}); // false
isGeneratorFunction(function* () {}); // true
```
